﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BookTheBook.Web.Helpers.PaginatedListCollection<BookTheBook.Data.Model.Book>>" %>

     <div id="pagination">
     <%
         if (null != Model)
         {
             if (Model.Count > 0)
             {
             %>
               <a href="Submit?query=<%=Model.Query%>&pageIndex=<%=1%>">First</a> 
             
             <%
               for (int i = 2; i < Model.PagesCount-1; i++)
                {
                   %>
                   <a href="Submit?query=<%=Model.Query%>&pageIndex=<%=i%>"><%=i%></a> 
                   <%
                }  
             %>     
             <a href="Submit?query=<%=Model.Query%>&pageIndex=<%=Model.PagesCount%>">Last</a>
             <%
             }
         }
     %>
     </div>